<template>
  <div class="all">
    <div class="getgoods">
      <div v-if="!items">
        <router-link :to="{path:'/chooseaddr'}">
          <i class="iconfont icon-location"></i>
          <span class="span1">请添加一个收货地址</span>
          <i class="iconfont icon-jiantou" @click="clickAction"></i>
        </router-link>
      </div>

      <div class="address" v-else>
        <router-link :to="{path:'/chooseaddr'}">
          <span class="a1">
            <i class="iconfont icon-location"></i>
            <i class="iconfont icon-jiantou" @click="clickAction"></i>
            <div class="div0">
              <div class="div1">
                <span class="name1">
                  {{items[num].name}}
                </span>
                <span class="phone">
                  {{items[num].sex}}
                  {{items[num].telephone}}
                </span>
              </div>
              <div class="div2">
                <span class="red">
                  {{items[num].label}}
                </span>
                <span class="detail">
                  {{items[num].detail}}
                </span>

              </div>
            </div>
          </span>
        </router-link>
      </div>
      <img src="../img/line.jpg" alt="" class="line">
    </div>
  </div>
</template>
<script>
  export default {
    name: "getgoods",
    data() {
      return {
        items: [],
        num: "",
      }
    },
    methods: {
      clickAction() {
        this.$router.push({ name: 'chooseaddr' })
      }
    },
    created() {
      this.items = JSON.parse(localStorage.getItem("arr2")),
        this.num = this.$router.history.current.query.key
      // console.log(this.items)
    },
  }
</script>
<style lang="less" scoped>
  .all {
    background-color: rgb(245, 245, 245);
  }

  .getgoods {
    margin-top: 44px;
    background-color: white;
  }

  .span1 {
    margin-left: 60px;
    display: inline-block;
    margin-top: 35px;
    font-size: 16px;
    color: rgb(49, 144, 232);
  }

  .icon-location {
    position: absolute;
    left: 15px;
    top: 70px;
    color: rgb(49, 144, 232);
    font-size: 20px;
  }

  .div1 {
    position: absolute;
    left: 45px;
    top: 60px;
  }

  .div2 {
    position: absolute;
    left: 45px;
    top: 90px;
  }

  .icon-jiantou {
    float: right;
    font-size: 13px;
    margin-right: 10px;
    margin-top: 40px;
  }

  .name1 {
    font-weight: 600;
    color: black;
  }

  .phone {
    font-size: 14px;
    color: rgb(53, 52, 52);
  }

  .red {
    height: 20px;
    line-height: 20px;
    background-color: rgb(241, 79, 30);
    color: white;
    font-size: 13px;
    border-radius: 3px;
  }

  .detail {
    margin-left: 10px;
    color: rgb(80, 80, 80);
    font-size: 13px;
  }

  .line {
    width: 100%;
    margin-top: 25px;
  }

  .name1 {
    font-weight: 600;
    font-size: 20px;
  }
</style>